<template>
  <!-- 待下订单列表信息 -->
  <div class="button">
    <el-button type="primary" @click="toCreateOrder">下订单</el-button>
  </div>
  <el-table
    ref="table"
    row-key="id"
    :data="list"
    border
    :header-cell-style="{ background: '#f5f7fa' }"
    @selection-change="handleSelection"
  >
    <el-table-column type="selection" width="55"> </el-table-column>
    <el-table-column label="ID" prop="id" width="55"> </el-table-column>
    <el-table-column label="订单号" prop="purchaseCode"> </el-table-column>
    <el-table-column label="物品名称" prop="productName"> </el-table-column>
    <el-table-column label="规格型号" prop="specificationName">
    </el-table-column>
    <!-- <el-table-column label="单价(元)" prop="price"> </el-table-column> -->
    <el-table-column label="请购数量" prop="productBuyNum"> </el-table-column>
    <el-table-column label="单位" prop="unitName"> </el-table-column>
    <el-table-column label="总价格(元)" prop="productBuyPrice">
    </el-table-column>
  </el-table>
</template>
<script>
export default {
  name: '',
  data () {
    return {
      selections: []
    }
  },
  props: {
    list: {
      type: Array,
      required: true,
      default: () => {
        return []
      }
    }
  },
  methods: {
    handleSelection (list) {
      this.selections = list

    },

    // 跳转到采购添加 下采购单
    toCreateOrder () {
      this.$TOOL.data.set("ORDERDATA", { ids: this.$route.query.ids, goodsList: this.selections })
      this.closeSelectedTag(this.$route)
      this.$router.push({
        path: '/goods/purchaseManagement/addPurchase',
        query: {
          mode: 'add',
          from: 'createOrder'
        }
      })
    },

    //关闭tag
    closeSelectedTag (tag) {
      this.$store.commit("removeViewTags", tag)
      this.$store.commit("removeIframeList", tag)
      this.$store.commit("removeKeepLive", tag.name)
    },

  }
}
</script>
<style lang="scss" scoped>
.button {
  margin-bottom: 15px;
}
</style>